/*
 * ErrorView.java
 *
 * Created on 16 de Agosto de 2008, 15:25
 */
package br.faimg.pomar.visual;


/**
 *
 * @author  diogo
 */
public class ErrorView extends javax.swing.JDialog {

    /** Creates new form ErrorView */
    public ErrorView() {
        initComponents();
    }

    public ErrorView( String erroMsg) {
        initComponents();
        mensagemdeErrojTextArea.setText(erroMsg.toString().toUpperCase().replaceAll("^JAVA.LANG.THROWABLE:", ""));
        sairjButton.requestFocus(true);
    }
    
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        sairjButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        mensagemdeErrojTextArea = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("AVISO");
        setAlwaysOnTop(true);
        setMinimumSize(new java.awt.Dimension(400, 200));
        setResizable(false);

        sairjButton.setText("SAIR");
        sairjButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sairjButtonActionPerformed(evt);
            }
        });

        mensagemdeErrojTextArea.setBackground(new java.awt.Color(255, 0, 0));
        mensagemdeErrojTextArea.setColumns(20);
        mensagemdeErrojTextArea.setEditable(false);
        mensagemdeErrojTextArea.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N
        mensagemdeErrojTextArea.setForeground(new java.awt.Color(254, 254, 254));
        mensagemdeErrojTextArea.setLineWrap(true);
        mensagemdeErrojTextArea.setRows(5);
        mensagemdeErrojTextArea.setAutoscrolls(false);
        mensagemdeErrojTextArea.setBorder(javax.swing.BorderFactory.createEtchedBorder(java.awt.Color.black, java.awt.Color.black));
        jScrollPane1.setViewportView(mensagemdeErrojTextArea);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 635, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(513, 513, 513)
                        .addComponent(sairjButton, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(sairjButton)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void sairjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sairjButtonActionPerformed

    setVisible(false);
}//GEN-LAST:event_sairjButtonActionPerformed

    /**
    * @param args the command line arguments
    */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new ErrorView().setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea mensagemdeErrojTextArea;
    private javax.swing.JButton sairjButton;
    // End of variables declaration//GEN-END:variables

}
